home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9208 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.unt.edu!news
  2. From: Steve Fogoros <sfogoros@hsc.unt.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Borland sqrt() bug?
  5. Date: Fri, 08 Mar 1996 13:34:38 -0800
  6. Organization: University of North Texas Health Science Center
  7. Message-ID: <3140A7EE.1DA3@hsc.unt.edu>
  8. References: <4hotp5$a1h@news.hk.linkage.net>
  9. NNTP-Posting-Host: sfogoros.hsc.unt.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win16; I)
  14.  
  15. Priscilla Ngie wrote:
  16. > I tired the following code
  17. >         float num;
  18. >         if (num > 0) sqrt(num);
  19. > and Borland C++ 4.02 returns me with an error
  20. >         sqrt: DOMAIN error
  21. > This error dialog box only pops up when num is a +ve number approaching
  22. > zero, eg 0.000000005.
  23. > Is this a bug of some kind? If not, how can I trun around this?
  24. > Priscilla Ngie
  25. > Future Solutions
  26. > Hong Kong
  27.  
  28. sqrt() takes a double as its argument and returns a double. Declare num 
  29. as double or cast it to double.
  30.  
  31. -- 
  32. Steve Fogoros, Academic Information Coordinator
  33. University of North Texas Health Science Center
  34. sfogoros@hsc.unt.edu
  35.